


from rest_framework import serializers
from goods.models import SPUSpecification

class SpecModelSerializer(serializers.ModelSerializer):
    # 接口要求序列化的结果是spu商品名称
    spu = serializers.StringRelatedField()
    spu_id = serializers.IntegerField()

    class Meta:
        model = SPUSpecification
        fields = [
            'id',
            'name',
            'spu',
            'spu_id'
        ]